// JED Manager
// (c) jimon game studio

#ifndef JEH_IJEDMANAGER
#define JEH_IJEDMANAGER

#include "jeUnknown.h"
#include "jeSingleton.h"
#include "jeJED_DataBlocks.h"

namespace je
{
	namespace core
	{
		//! JED Manager
		class IJEDManager:public je::jeUnknown
		{
		public:
			//! Destructor
			virtual ~IJEDManager()
			{
			}

			//! Get Factory
			virtual jeJED_DataBlock::DataBlockFactoryType * GetFactory() = 0;

			//! Load
			virtual jeJED_DataBlock * Load(IBuffer * Buffer,const jeStringw & Path = "") = 0;

			//! Save
			virtual void Save(IBuffer * Buffer,jeJED_DataBlock * RootBlock) = 0;

			//! Return true if this is jed format
			virtual u1 IsCanLoadThis(IBuffer * Buffer) = 0;

			//! Create Data Block
			virtual jeJED_DataBlock * CreateDataBlock(u16 Id)
			{
				jeJED_DataBlock * Block = GetFactory()->Create(Id);
				Block->SetFactory(GetFactory());
				return Block;
			}
		};

		DECLARE_SINGLETON_E(JE_ENGINE_FUNCTION_API,JE_ENGINE_FUNCTION_CALL,JEDManager)
	}
}

#endif
